package com.example.smartcity_poverty.ui.AllService.StopWhere

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import com.example.smartcity_poverty.logic.Repository
import com.example.smartcity_poverty.logic.model.stop.StopWhereAll
import com.example.smartcity_poverty.logic.model.stop.StopWhereTime

/**
 *  created by ikun
 *  ANDROID STUDIO - version 4.0
 *  email: jinkunwei41@gmail.com
 * --------------------------------
 *
 **/
class StopWhereViewModel : ViewModel(){


    // 停车场列表
    private val stopWhereAll = MutableLiveData<String>().apply {
        postValue("aaa")
    }
    val stopWhereList = ArrayList<StopWhereAll.RowsBean>()
    val stopWhereLiveData = Transformations.switchMap(stopWhereAll){
        Repository.getStopWhereAll()
    }


    // 停车记录
    private val stopSw = MutableLiveData<String>()
    val stopSwList = ArrayList<StopWhereTime.RowsBean>()
    val stopSwLiveData = Transformations.switchMap(stopSw){ query ->
        Repository.getSWAll(query)
    }
    fun stopSwAll(time: String){
        stopSw.value = time
    }



}